package com.io;

import java.io.*;

/**
 * @author weijingchen
 * @DateTime 2025-06-17
 */
public class StreamReaderTest03 {
    public static void main(String[] args) throws IOException {
        //1、创建对象指定字符集
        InputStreamReader isr = new InputStreamReader(new FileInputStream("src/main/resources/a.txt"), "utf-8");
        OutputStreamWriter osw = new OutputStreamWriter(new FileOutputStream("src/main/resources/b.txt"), "utf-8");
        //读取数据
        int ch;
        while ((ch = isr.read()) != -1) {
            osw.write(ch);
            System.out.print((char) ch);
        }
        isr.close();
        osw.close();
    }
}
